<?php @include('header.php'); ?>

        <div class="wrprPOS clBg5">
            <div class="wrpPOS clearfix">
                <div class="wrpPOSLogIn clBg2">
                    <div class="wrprTopPOSLogIn clBg3 clBd2 bdBtm">
                        <div class="wrpOutTopPOSLogIn">
                            <div class="wrpInTopPOSLogIn">
                                <div class="wrpTopPOSLogIn clearfix">
                                    <span class="icoPOS logoPOS"></span>
                                    <span class="txtPOS">Point of Sale</span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="wrprBtmPOSLogIn clBg2">
                        <div class="wrpOutBtmPOSLogIn">
                            <div class="wrpInBtmPOSLogIn">
                                <div class="wrnLS wls09" id="validateerror-login">
                                   <!-- <div class="errLS clErrBg">
                                        <span class="ico icoErr"></span>
                                    </div>
                                    <span class="spnErrLS clErrTxt fs02">Username/Email and Password do not match.</span>-->
                                </div>
                                <form class="wrpBtmPOSLogIn" id="fromlogin" method="post" >
                                    <input type="text" name="username" id="login-username" placeholder="Username" class="inpLIPOS clBg3 clTxtPOSB fs04">
                                    <input type="password" name="password" id="login-password" placeholder="Password"  class="inpLIPOS clBg3 clTxtPOSB fs04">
                             

                                    
                                    <button class="btnPOSB btnLIPOS fs07">Log In</button>

                        <a href="<?=$data['linklogin']?>&pos=1&linkto=/pos/sell" onclick="loaddata()" >Log In with Facebook</a>  
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
<script>
function validateEmail(email) { 
    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
    return re.test(email);
} 
$('#fromlogin').submit(function() {

//alert('');

var checkerror=new Array();
var rowerror=0;
var datasend={};
if($("#login-username").val()=="")
{
    
     checkerror[rowerror++]={msg:"Please request field input",code:4,obj:$("#login-username")};
     

}
else
{
    if(validateEmail($("#login-username").val()))
    {
    datasend['email']=$("#login-username").val();
    
    }else
    {
    datasend['username']=$("#login-username").val();
    
    }

}

if($("#login-password").val()=="")
{

    checkerror[rowerror++]={msg:"Please request field input",code:4,obj:$("#login-password")};

}
else
{
    datasend['password']=$("#login-password").val();


}


if($("#fromlogin #rem").is(':checked'))
{
datasend['rememberme']=1;
//console.log(datasend);
//return false;

}

datasend['pos']=1;


if(checkerror.length==0)
{

loaddata();

$.post(serviceinfo+"login",datasend,
function(data){
loadclosedata();
if(data.error.response)
{
alertboxtext(data.error.error,$("#validateerror-login"));

}else
{

location.href=baseinfo+'/pos/sell';


}

return false;
});

return false;
}else
{

alertboxtext(checkerror,$("#validateerror-login"));

}












return false;



});
</script>
<?php @include('footer.php'); ?>